﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _master_default : System.Web.UI.MasterPage
{
    private const int NUMBER_TABS = 3;

    public int SelectedTabIndex
    {
        get
        {
            if (Session["TAB_INDEX"] == null)
                return 0;

            return (int)(Session["TAB_INDEX"]);
        }

        set
        {
            if (value > NUMBER_TABS || value < 0)
                return;

            Session.Add("TAB_INDEX", value); 
        }

    }

    protected void Page_Load(object sender, EventArgs e)
    {
        HighlightSelectedTab();
    }

    private void HighlightSelectedTab()
    {
         HtmlControl tab = (HtmlControl)(this.FindControl("tab" + this.SelectedTabIndex.ToString()));
         tab.Attributes["class"] = "menuitemselected";
    }
}
